package ${packageName};

import javax.persistence.Entity;
import javax.persistence.Table;
import com.it.cloud.core.dao.entity.BaseEntity;
import lombok.*;
import java.util.Objects;
import org.hibernate.Hibernate;
import org.hibernate.annotations.Where;
<#if hasFk>
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
</#if>
<#list proTypeSet as proType>
import ${proType};
</#list>

/**
* @author lt
*/

@Entity
@Table(schema = "GRIDVIEW")
@Getter
@Setter
@ToString
@AllArgsConstructor
@NoArgsConstructor
@Where( clause = "is_del = false" )
public class ${name} extends BaseEntity {

	private static final long serialVersionUID = 1L;
	
	<#list proList as pro> 
	<#if pro.column.comment??&&pro.column.comment!="">
	/** ${pro.column.comment} */
	</#if>
	public static final String ${pro.staticName} = "${pro.name}";
	</#list>
	
 	<#list proList as pro> 
 	<#if pro.isFk>
 	
 	@ManyToOne(targetEntity = ${pro.pkClassName}.class)
	@JoinColumn(name = "${pro.column.name}")
	private ${pro.pkClassName} ${pro.name};
 	<#else>
 	private ${pro.shortTypeName} ${pro.name};
	</#if>
	</#list>

	@Override
	public boolean equals(Object o) {
		if (this == o) {
			return true;
		}
		if (o == null || Hibernate.getClass(this) != Hibernate.getClass(o)) {
			return false;
		}
		${name} that = (${name}) o;
		return id != null && Objects.equals(id, that.id);
	}

	@Override
	public int hashCode() {
		return getClass().hashCode();
	}
}